package com.lindroy.jetpacknotes.navigation.fragment

import android.os.Bundle
import androidx.navigation.NavOptions
import androidx.navigation.fragment.findNavController
import com.lindroy.jetpacknotes.R
import com.lindroy.jetpacknotes.base.BaseFragment
import kotlinx.android.synthetic.main.fragment_b.*

/**
 * @author Lin
 * @date 2021/11/9
 * @function
 */
class BFragment : BaseFragment(R.layout.fragment_b) {
    override fun initView(savedInstanceState: Bundle?) {

    }

    override fun initListener() {
        //在代码中动态设置动画
        val navOptions = NavOptions.Builder()
            .setEnterAnim(R.anim.slide_in_right)
            .setExitAnim(R.anim.slide_out_left)
            .setPopEnterAnim(R.anim.slide_in_left)
            .setPopExitAnim(R.anim.slide_out_right)
            .build()
        buttonB.setOnClickListener {
            findNavController().navigate(
                R.id.action_b_to_c,
                Bundle(),
                navOptions
            )
        }
    }

}